package com.wxtt.android.item;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.fast.dev.frame.Adapter.recycleview.items.BaseItem;
import com.fast.dev.frame.ui.V;
import com.wxtt.android.R;
import com.wxtt.android.bean.WxArticleBean;

/**
 * 说明：微信头条文章列表Item
 * <p/>
 * 作者：fanly
 * <p/>
 * 时间：2016/1/25 20:07
 * <p/>
 * 版本：verson 1.0
 */
public class WxAritcleItem extends BaseItem<WxAritcleItem,WxAritcleItem.ViewHolder,WxArticleBean>{

    @Override
    public ViewHolder createViewHolder(View v) {
        return new ViewHolder(v);
    }

    @Override
    public void convert(ViewHolder holder, final WxArticleBean item) {
        V.setText(holder.tv_item_title,item.getTitle());
        V.setText(holder.tv_item_source, item.getSource());
//        V.setImageView(holder.iv_item_firstpic.getContext(), holder.iv_item_firstpic, item.getFirstImg());
    }

    @Override
    public int getLayoutRes() {
        return R.layout.item_wx_article;
    }

    protected static class ViewHolder extends RecyclerView.ViewHolder{
        public TextView tv_item_title;
        public TextView tv_item_source;
        public ImageView iv_item_firstpic;
        public ViewHolder(View view){
            super(view);
            tv_item_title = (TextView) view.findViewById(R.id.tv_item_title);
            tv_item_source = (TextView) view.findViewById(R.id.tv_item_source);
            iv_item_firstpic = (ImageView) view.findViewById(R.id.iv_item_firstpic);
        }
    }
}
